package com.yuzhi.master.drainStPptnr.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuzhi.common.core.mapper.BaseMapperPlus;
import com.yuzhi.master.drainStPptnr.domain.bo.DrainStPptnRBo;
import com.yuzhi.master.drainStPptnr.domain.entity.DrainStPptnr;
import com.yuzhi.master.drainStPptnr.domain.vo.DrainStPptnrCharVo;
import com.yuzhi.master.drainStPptnr.domain.vo.DrainStPptnrVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Mapper
public interface DrainStPptnrMapper extends BaseMapperPlus<DrainStPptnrMapper, DrainStPptnr, DrainStPptnrVo> {

    // 查询实时数据
    DrainStPptnrVo selectCombinedData(@Param("stcd") String stcd);

    // 查询分钟降雨量
    List<DrainStPptnrCharVo> selectChartData(
            @Param("stcd") String stcd,
            @Param("startTime") Date startTime,
            @Param("endTime") Date endTime
    );

    // 监测预警展示数据
    Page<DrainStPptnrVo> monitorData(
            @Param("page") Page<DrainStPptnrVo> page,
            @Param(Constants.WRAPPER) Wrapper<DrainStPptnRBo> queryWrapper
    );


    List<Map<String, Object>> selectByFactAndType(@Param("stcd") String stcd,
                                                  @Param("type") Integer type,
                                                  @Param("startTime") Date startTime,
                                                  @Param("endTime") Date endTime);

    // 查询指定日期的数据
    DrainStPptnr selectLatestRecordByDay(@Param("day") LocalDate day);

    /**
     * 查询日雨量数据
     * @param page
     * @param queryWrapper
     * @return
     */
    Page<DrainStPptnrVo> getStPptnrTjPageData(
            @Param("page") Page<DrainStPptnrVo> page,
            @Param(Constants.WRAPPER) Wrapper<DrainStPptnRBo> queryWrapper
    );

}
